import utime
from neopixel import NeoPixel
from machine import Pin
from 驱动.ws2812Screen import WS2812Screen
from setting import *
 
from ImgData import *
 
import random

SCREEN_WIDTH = 32  # 屏幕宽
SCREEN_HEIGHT = 8  # 屏幕高

num_leds = SCREEN_WIDTH * SCREEN_HEIGHT  # 像素数量(led灯珠数量)

np = NeoPixel(Pin(14), num_leds + 64)  # 创建像素序列对象

screen = WS2812Screen(np, SCREEN_WIDTH, SCREEN_HEIGHT)  # 创建屏幕对象

print("test=====================")
 
# 0-10数字显示
for i in range(10):
    print(i)
    screen.draw_num(i*4,1,i,(random.randint(20,200),random.randint(20,200),random.randint(20,200)),1)
    screen.show()
    utime.sleep(0.1)
    np.write()

# 清屏
np.fill((0,0,0))
np.write()

utime.sleep(0.1)

screen.drawNumber(1234567890, -1,1,4, (random.randint(20,200),random.randint(20,200),random.randint(20,200)),1)
screen.show()
